package com.chenwy.example.resolver;

import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import javax.servlet.http.HttpServletRequest;
public class CompatibleMultipartResolver extends CommonsMultipartResolver {

    private String excludeUrls;
    private String[] excludeUrlArray;

    public String getExcludeUrls() {
        return excludeUrls;
    }


    public void setExcludeUrls(String excludeUrls) {
        this.excludeUrls = excludeUrls;
        this.excludeUrlArray = excludeUrls.split(",");
    }



    @Override
    public boolean isMultipart(HttpServletRequest request) {
        for (String url: excludeUrlArray) {
            // 这里可以自己换判断
            System.out.println("RequestURI=" + request.getRequestURI());
            if (request.getRequestURI().contains(url)) {
                return false;
            }
        }

        return super.isMultipart(request);
    }
}
